import { inherit } from '../utils/common';
import { glLocation } from '../WebGLRenderer';
import {
  assignVertexAttrib3f,
  assignVertexAttrib1f,
} from '../WebGLRenderer/gl/gl-assign'
import Entity from './Entity';

export function Point3d(x, y, z = 0) {
  this.x = x;
  this.y = y;
  this.z = z;
}
Point3d.prototype = inherit(Entity.prototype);
Point3d.prototype.constructor = Point3d;

Point3d.prototype.render = function (gl) {
  if(!gl) console.error('[rcad] render Point3d gl is null')
  assignVertexAttrib3f(gl, glLocation.a_Position, this.x, this.y, this.z);
  assignVertexAttrib1f(gl, glLocation.a_PointSize, 20.0);
  gl.drawArrays(gl.POINTS, 0, 1);
}
// export class Point3d {
//   constructor(x, y, z = 0){
//     this.x = x;
//     this.y = y;
//     this.z = z;
//   }
//   render(gl, glLoc) {
//     let color = null;
//     assignVertexAttrib3f(gl, glLoc.a_Position, this.x, this.y, this.z)
//     assignVertexAttrib1f(gl, glLoc.a_PointSize, 5)
//     assignUniform4f(gl, glLoc.u_FragColor, color.r, color.g, color.b, color.a);
//     drawPt(gl)
//   }
// }